﻿<%@ page language="java" contentType="text/html; charset=UTF-8"
		import="java.util.*,com.netjava.pojo.*,
		org.springframework.context.ApplicationContext,
		org.springframework.web.context.support.WebApplicationContextUtils,
		com.netjava.service.*
		"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<jsp:include page="/jsp/include/logo.jsp"></jsp:include>
<c:choose>
	<c:when test="${logined}">
		<jsp:include page="/jsp/include/loginedHead.jsp"></jsp:include>
	</c:when>
	<c:otherwise>
		<jsp:include page="/jsp/include/header.jsp"></jsp:include>
	</c:otherwise>
</c:choose>
<script type="text/javascript" src="${contextPath }/jsp/js/refreshClock.js">
</script>
<script type="text/javascript">
// 开始运行
window.onload = function(){
	
// nextelapse是定时时间, 初始时为100毫秒
// 注意setInterval函数: 时间逝去nextelapse(毫秒)后, onTimer才开始执行
	//alert(nextelapse);
	timer = window.setInterval(onTimer, nextelapse); 
	
    autoFlag=window.setInterval(sendRequest,5000);

	
}
	
</script>
<%
ServletContext context=pageContext.getServletContext();
ApplicationContext appContext=WebApplicationContextUtils.getWebApplicationContext(context);
//取得所有正在竞拍的商品
IAuctioningService aucService=(IAuctioningService)appContext.getBean("auctioningService");
List<Auctioning> auctioningList=aucService.getAllAuc();
request.getSession().setAttribute("auctioningList",auctioningList);
//取得所有即将竞拍的商品
IPreauctionService preaucService=(IPreauctionService)appContext.getBean("preauctionService");
List<Preauction> preauctionList=preaucService.getAllPreauc();
request.getSession().setAttribute("preauctionList",preauctionList);
//取得所有结束竞拍的商品
IEndAuctionService endAuctionService=(IEndAuctionService)appContext.getBean("endAuctionService");
List<EndAuction> endAuctionList=endAuctionService.getAllEndauc();
request.getSession().setAttribute("endAuctionList",endAuctionList);

//取得竞拍结果消息
List<EndAuction> auctionResult=endAuctionService.getAllEndaucByTime();
   if(auctionResult.size()>4){
	    	for(int i=4;i<auctionResult.size();i++){
	    		
	    		auctionResult.remove(i);
	    	}
	    	
	    }
	    request.setAttribute("auctionResult",auctionResult);
%>


<table width="960" border="0" align="center" cellpadding="0" cellspacing="0">
	<tr>
		<td height="10"></td>
	</tr>
	<tr>
		<td height="48" background="${contextPath }/jsp/images/x1.gif"><table width="960" border="0" cellspacing="0" cellpadding="0">
				<tr>
					<td width="25" height="48">&nbsp;</td>
					<td width="38" align="left" valign="middle" class="font_ctm1"><strong><img src="${contextPath }/jsp/images/x0.jpg" height="48" align="absmiddle" /></strong></td>
					<td width="872" align="left" valign="middle" class="font_ctm1">
						<marquee scrolldelay="1" scrollamount="2" loop="-1"
							onmouseover="this.stop();" onmouseout="this.start();">
							<c:forEach  items="${auctionResult}" var="endauction">
							恭喜<span style="color: green;" id="username">${endauction.user.userName }</span>
							在<span id="time">${endauction.endTime } </span>  
							获得了<span style="color: green;" id="productname">${endauction.product.productName }</span> 
							价格：<span id="price">${endauction.product.currentPrice }</span>
					
							节省：<span id="save"><fmt:formatNumber type="number" value="${(endauction.product.currentPrice-endauction.product.basePrice)*100/endauction.product.currentPrice}" pattern="##.##"/>%
							</span>
							<span style="font-weight: bold; color: #FFA800;"> *** </span> 
							</c:forEach>
						</marquee>
					</td>
					<td width="25">&nbsp;</td>
				</tr>
			</table></td>
	</tr>
</table>

<table width="960" border="0" align="center" cellpadding="0" cellspacing="0">
	<tr>
		<td><img src="${contextPath }/jsp/images/bg_1.gif" width="960" height="69" border="0" usemap="#Map" /></td>
	</tr>
	<tr>
		<td height="10"></td>
	</tr>
</table>
<map name="Map">
	<area shape="rect" coords="811,11,939,58" href="${contextPath }/jsp/help.jsp#saleReturn">
	<area shape="rect" coords="653,12,781,59" href="${contextPath }/jsp/help.jsp#delivery">
	<area shape="rect" coords="493,12,621,59" href="${contextPath }/jsp/help.jsp#auction" target="_self">
	<area shape="rect" coords="334,12,462,59" href="${contextPath }/jsp/index.jsp#moreAuction">
	<area shape="rect" coords="177,12,305,59" href="${contextPath }/jsp/buyGoldBid.jsp">
	<area shape="rect" coords="20,11,148,58" href="${contextPath }/jsp/regist.jsp">
</map>

<script type="text/javascript" src="_Member/Scripts/login.js"></script>
<script type="text/javascript" src="_Home/Scripts/top.js"></script>

<!--<a href="NewsInfo.asp?Id=163" target="_blank"><img src="/UpLoadFiles/ad/father.gif" width="960" height="80" border="0" /></a>-->
<table border="0" cellpadding="0" cellspacing="0">
	<tr><td height="5"></td></tr>
</table>
<table width="960" border="0" align="center" cellpadding="0" cellspacing="0">
	<tr>
    <td height="250" align="left" valign="top">
    <table width="651" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td height="30" align="right" valign="bottom" background="${contextPath }/jsp/images/bg_2.gif">
        <table width="600" border="0" cellpadding="0" cellspacing="0">
          <tr>
            <td height="25" align="right">
            <a id="moreAuction" name="moreAuction" href="${contextPath }/product.do?operation=showAllByState&state=1&page=1&back=0">
            	查看更多热拍商品</a></td>
            <td width="10">&nbsp;</td>
          </tr>
        </table>
       </td>
      </tr>
      <tr>
         
        <td width="600" height="100" align="center" valign="top" background="${contextPath }/jsp/images/bg_3.gif">
        	<div id="ProductDataPaniel_Index" style="width:100%;height:100">
        		
        		<c:forEach var="i" begin="0" step="1" end="3">
        		<div id="auctioningPro" style="width:25%;float:left">
        		<table><tr>
			
			<td height="157" align="center"> 
				<table width="140" border="0" cellpadding="0" cellspacing="0">
					<tr>
						<td><img src="${contextPath }/jsp/images/bg_12.gif" width="140" height="5" /></td>
					</tr>
					<tr>
						<td align="center" background="${contextPath }/jsp/images/bg_13.gif">
						 
							<img src="${contextPath }/jsp/proimages/${auctioningList[i].product.image1 }" 
							     alt="" width="130" height="120" border="0" 
							     onclick="window.location='${contextPath }/product.do?operation=showProMsg&productId=${auctioningList[i].product.productId}'" 
							     style="cursor:pointer;"/>
							
						</td>
					</tr>
					<tr>
						<td height="26" align="center" valign="middle" background="${contextPath }/jsp/images/bg_13.gif">
							<div id="remainTime${i }">${auctioningList[i].remainTime }</div>
        					<input type="hidden" id="auctioningId${i }" value=${auctioningList[i].auctioningId } />
						</td>
					</tr>
					<tr>
						<td height="40" align="center" valign="middle" background="${contextPath }/jsp/images/bg_13.gif">
							<a href="${contextPath }/product.do?operation=showProMsg&productId=${auctioningList[i].product.productId}" >
							  <c:if test="${auctioningList[i].product.productName eq null}">
							  	该商品拍卖完成
							  </c:if>
							  ${auctioningList[i].product.productName }
							</a>
						</td>
					</tr>
					<tr>
						<td height="26" align="center" valign="middle" background="${contextPath }/jsp/images/bg_13.gif" >
						<%User user=(User)request.getSession().getAttribute("loginUser");
        			if(null!=user){ 
        			if(null!=user.getCard()&&user.getCard().getCardValue()>0){
        			    			
        			%><a href="${contextPath }/product.do?operation=showProMsg&productId=${auctioningList[i].product.productId}">
        				<img src="${contextPath }/jsp/images/an_3.gif" /></a>
        			
        			<%}else{%>
        			<img src="${contextPath }/jsp/images/an_3.gif" onclick="alert('对不起你的金点数不足，请充值后再来竞拍！');"/>
        			<%}}
        			else{
        			 %><img src="${contextPath }/jsp/images/an_3.gif"  onclick="alert('请先登录！');"/><%} %>
        			</td></tr>
					<tr>
						<td><img src="${contextPath }/jsp/images/bg_14.gif" width="140" height="6" /></td>
					</tr>
				</table>
			</td>	
			</tr></table>
        		</div>
        		</c:forEach>
        		
       		</div>
        </td>
      </tr>
 
      
      <tr>
        <td><img src="${contextPath }/jsp/images/bg_4.gif" width="651" /></td>
      </tr>
    </table></td>
    <td align="right" valign="top">
    <link href="${contextPath }/jsp/css/basic.css" rel="stylesheet" type="text/css" media="all" />
<script>
	<!--
	function setTab(name,cursel,n)
	{
		for(i=1;i<=n;i++)
		{
			var menu=document.getElementById(name+i);
		  	var con=document.getElementById("con_"+name+"_"+i);
		  	menu.className=i==cursel?"hover":"";
		  	con.style.display=i==cursel?"block":"none";
		}
	}
	//-->
</script>
<div id="Tab1">
	<div class="Menubox">
		<ul>
		   <a><li id="one1" onmouseover="setTab('one',1,2)"  class="hover">..</a>
		   </div>
		   <div id="con_one_2" style="display:none">
			 <ul>
				<a href="Informations.asp?id=200972nqykrxohss2bsd4" target="_blank"><li class="black_b">Twitter要求第三方..</li></a>
			</ul>
			<ul>
				<a href="Informations.asp?id=200972hkselrhammv5m7x" target="_blank"><li class="black_b">瑞星：病毒盗取网游永恒之..</li></a>
			</ul>
			<ul>
				<a href="Informations.asp?id=20097270i4ag7zcclubvn" target="_blank"><li class="black_b">开心网网友用性爱视频勒索..</li></a>
			</ul>
			<ul>
				<a href="Informations.asp?id=200972bel7ekb4fgoxfzr" target="_blank"><li class="black_b">新版华龙网今试上线</li></a>
			</ul>
			<ul>
				<a href="Informations.asp?id=200972ru3ov2rkww6fwh8" target="_blank"><li class="black_b">阿里巴巴复星等民企携手参..</li></a>
			</ul>
			<ul>
				<a href="Informations.asp?id=200972nqxkqwngss1brc4" target="_blank"><li class="black_b">55BBS创始人韩华有意..</li></a>
			</ul>
			<span id="more"><a href="Informations.asp" target="_blank" style="color:#666666">更多..</a></span>
	   
</div>
<table width="291" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td height="10"></td>
  </tr>
</table>
<table width="291" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td height="10"></td>
  </tr>
</table>
<table width="291" border="0" cellspacing="0" cellpadding="0" background="${contextPath }/jsp/images/1.gif">
  <tr>
    <td height="75" background="${contextPath }/jsp/images/tu1.gif"></td>
  </tr>
  <tr>
    <td height="20" >友情链接</td>
  </tr>
  <tr>
    <td height="30" ><a href="http://www.google.cn/" ><img src="${contextPath }/jsp/images/tu2.gif" width="85"></a></td>
  </tr>
  <tr>
    <td height="5" ></td>
  </tr>
  <tr>
    <td height="30"><a href="http://cn.yahoo.com/" ><img src="${contextPath }/jsp/images/tu3.gif" width="85"></a></td>
  </tr>
  <tr>
    <td height="5" ></td>
  </tr>
  <tr>
    <td height="30" ><a href="http://www.chinabank.com.cn/index/index.shtml" ><img src="${contextPath }/jsp/images/tu4.gif" width="85"></a></td>
  </tr>
  <tr>
    <td height="5" ></td>
  </tr>
  <tr>
    <td height="30" ><a href="https://www.alipay.com/" ><img src="${contextPath }/jsp/images/tu5.gif" width="85"></a></td>
  </tr>
</table>
<table width="291" border="0" cellspacing="0" cellpadding="0">
  
  <tr>
    <td align="center" valign="top" background="${contextPath }/jsp/images/bg_6.gif"><table width="100%" border="0" cellspacing="0" cellpadding="0">
       
      </table>
    </td>
  </tr>
</table>
<map name="Map2" id="Map2">
  <area shape="rect" coords="221,3,285,24" href="News.asp" />
</map>
</td>
  </tr>
</table>

<table width="960" border="0" cellspacing="0" cellpadding="0">
	<tr>
		<td height="7"></td>
	</tr>
</table>

<table width="960" border="0" cellpadding="0" cellspacing="0" align="center">
  <tr>
    <td height="30" align="right" valign="bottom" background="${contextPath }/jsp/images/jjsj.jpg">
	<table width="700" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td height="25" align="right" class="font_Gray">
        	<a href="${contextPath }/product.do?operation=showAllByState&state=0&page=1&back=0">
        		查看更多商品</a>
        </td>
        <td width="20">&nbsp;</td>
      </tr>
    </table>
	</td>
  </tr>
  
  <tr>
  
    <td background="${contextPath }/jsp/images/bg_10.gif" align="center">
		<table width="920" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td height="20">&nbsp;</td>
      </tr>
    </table>
      <table width="940" height="130" border="0" cellspacing="0" cellpadding="0">
           <c:forEach var="k" begin="0" step="1" end="5">
			   <td height="130" align="left"> 
				<table width="140" border="0" cellpadding="0" cellspacing="0" class="product_lPaniel">
					<tr>
						<td><img src="${contextPath }/jsp/images/bg_12.gif" width="140" height="5" /></td>
					</tr>
					<tr>
						<td align="center" background="${contextPath }/jsp/images/bg_13.gif">
							<img src="${contextPath }/jsp/proimages/${preauctionList[k].product.image1 }" 
							     alt="" width="130" height="120" border="0" 
							     onclick="window.location='${contextPath }/product.do?operation=showProMsg&productId=${preauctionList[k].product.productId}'" 
							     style="cursor:pointer;"/>
						</td>
					</tr>
					<tr>
						<td height="26" align="center" valign="middle" background="${contextPath }/jsp/images/bg_13.gif" class="font_Gray">
							<a href="${contextPath }/product.do?operation=showProMsg&productId=${preauctionList[k].product.productId}" class="b">${preauctionList[k].product.productName }</a>
						</td>
					</tr>
					<tr>
						<td><img src="${contextPath }/jsp/images/bg_14.gif" width="140" height="6" /></td>
					</tr>
				</table>
			   </td>	
		
		   </c:forEach>	
	
      </table>

  <tr>
    <td><img src="${contextPath }/jsp/images/bg_11.gif" width="960" height="34" /></td>
  </tr>
<table width="960" border="0" cellspacing="0" cellpadding="0">
	<tr>
		<td height="7"></td>
	</tr>
</table>

<table width="960" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td height="30" align="right" valign="bottom" background="${contextPath }/jsp/images/yjjs.jpg">
    <table width="700" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td height="25" align="right" class="font_Gray">
        	<a href="${contextPath }/product.do?operation=showAllByState&state=2&page=1&back=0">
        		查看更多商品</a>
        </td>
        <td width="15">&nbsp;</td>
      </tr>
    </table>
    </td>
  </tr>
  <tr>
    <td height="177" align="center" valign="top" background="${contextPath }/jsp/images/bg_15.gif">
    <table width="920" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td height="20">&nbsp;</td>
      </tr>
    </table>
      <table width="940" border="0" cellspacing="0" cellpadding="0">
      <tr>
          <c:forEach var="j" begin="0" step="1" end="5">
          
			<td height="157" align="left">	 	
				<table width="140" border="0" cellpadding="0" cellspacing="0" class="product_lPaniel">
					<tr>
						<td><img src="${contextPath }/jsp/images/bg_12.gif" width="140" height="5" /></td>
				  </tr>
					<tr>
						<td align="center" background="${contextPath }/jsp/images/bg_13.gif">
							<img src="${contextPath }/jsp/proimages/${endAuctionList[j].product.image1 }"
							 alt="" width="130" height="120" border="0" 
							 onclick="window.location='${contextPath }/product.do?operation=showProMsg&productId=${endAuctionList[j].product.productId}'" style="cursor:pointer;"/>
						</td>
				  </tr>
					<tr>
						<td height="26" align="center" valign="middle" background="${contextPath }/jsp/images/bg_13.gif" class="font_Gray">
							<a href="${contextPath }/product.do?operation=showProMsg&productId=${endAuctionList[j].product.productId}" class="b" style="padding:0 1px 0 1px;">
								${endAuctionList[j].product.productName }
							</a>
						</td>
				  </tr>
					<tr>
						<td><img src="${contextPath }/jsp/images/bg_14.gif" width="140" height="6" /></td>
				  </tr>
				</table>
			</td>
			</c:forEach>

		</tr>
		<tr><td height="10px">&nbsp;</td></tr>
		
    </table></td>
  </tr>
  <tr>
    <td><img src="${contextPath }/jsp/images/bg_16.gif" width="960" height="24" /></td>
  </tr>
</table>
<jsp:include page="/jsp/include/footer.jsp"></jsp:include>